<?php
    // include('./config.php');
    // $username = $_GET['username'];
    // $password = $_GET['password'];
    // //拼接字符串
    // $sql = "insert into users (username,password) values ('$username','$password')";
    // echo "$username";
    // $res = mysql_query($sql);
    // echo "<meta charset = 'utf-8'>";
    // if($res){
    //     echo "注册成功，<a href='../html/login.html'>请登录</a>";
    // }else{
    //         echo "注册失败，<a href ='../html/register.html'>请重新注册</a>";
    // }
    include('../config.php');

$username = $_GET['username'];
$password = $_GET['password'];


$sql = "insert into users (name,password)values('$username','$password')";

$res = mysql_query($sql);

if ($res) {
  echo json_encode(array(
    "code" => 200,
    "body" => array(
      "msg" => "新增商品成功，你好棒棒"
    )
  ));
} else {
  echo json_encode(array(
    "code" => 201,
    "body" => array(
      "msg" => "网络错误，别试了"
    )
  ));
}

?>